package cn.rubintry.animate.core.ext


fun Any?.toFloat(): Float {
    if(null == this){
        return 0f
    }
    return when(this.javaClass){
        Int::class.java -> {
            (this as Int).toFloat()
        }

        Integer::class.java -> {
            (this as Int).toFloat()
        }

        Float::class.java -> {
            return this as Float
        }

        else -> {
            0f
        }
    }
}